package epam.bank.service;

import epam.bank.domain.Payment;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import epam.bank.repository.api.IPaymentRepository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: dima
 * Date: 10.03.13
 * Time: 2:20
 * To change this template use File | Settings | File Templates.
 */

@Service("paymentService")
@Repository
@Transactional
public class PaymentService implements IPaymentService {

    @Autowired
    private IPaymentRepository paymentRepository;


    @Override
    @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    public List<Payment> getPaymentsByInvoice(Long invoiceId) throws IllegalArgumentException {
        return paymentRepository.getPaymentsByInvoice(invoiceId);
    }
}
